<template>
  <div class="person">
    <h2 ref="title2">中国</h2>
    <button @click="btn">点击输出</button>
  </div>
</template>

<script lang="ts" setup name="Person">
import { ref, defineExpose } from "vue";

// 创建和title2一样的ref,用于存储ref标记的内容

let title2 = ref();

function btn() {
  console.log(title2.value);
}
let a = ref("踢啊");

defineExpose({
  a,
});
</script>

<style scoped>
.person {
  width: 100%;
  background-color: skyblue;
}
</style>
